package com.jd.job.keeper;

import com.jd.jobkeeper.client.JobConfig;
import com.jd.jobkeeper.client.JobWorkerNode;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;


@SpringBootApplication
public class ClientDemo {

    public static void main(String[] args) throws Exception {

        SpringApplication springApplication = new SpringApplication(ClientDemo.class);
        springApplication.run(args);

        JobConfig jobConfig = new JobConfig();
        jobConfig.setApp("test");
        jobConfig.setNamespace("default");
        jobConfig.addLabel("unit1");
        jobConfig.setIndex("http://localhost:8900/address");
        //jobConfig.setUrl("localhost:19000");
        JobWorkerNode node = new JobWorkerNode(jobConfig);
        node.registry(new BizTaskHandler());
        node.start();

        synchronized (springApplication) {
            springApplication.wait();
        }

    }
}
